function [f, F, bigK, W,  p, P, bigP, sigma_noise, dim, Hyps] = ...
    get_approx_laplace(hyps, cov_func, n, n_class, x, y, approxF)



sigma_noise = 1e-7;
%sigma_noise = 0;


dim = length(hyps) / n_class;
if n_class == 0
  disp('n_class == 0');
  error('this is stupid');
end
Hyps = reshape(hyps, dim, n_class);
bigK = zeros(n*n_class); 
K = zeros(n,n,n_class); 
for c = 1:n_class
  K(:,:,c) = feval(cov_func, Hyps(:,c), x) + sigma_noise*eye(n);
  crn = 1 + (c-1)*n : c*n; 
  bigK(crn,crn) = K(:,:,c);
end 

%if 0
if (nargin <= 6)
    f = alg_3_3(n, n_class, K, y);
else
    f = alg_3_3(n, n_class, K, y, approxF);
end
%end
%f = approxF; % testing temp
F = reshape(f, n, n_class);
P  = get_probabilities_softmax(F, n_class);
p  = P(:); 

bigP = zeros(n_class*n,n);
for i = 1 : n_class
  bigP((i-1)*n+1 : i*n,:) = diag(P(:, i));
end
W = diag(p) - bigP * bigP';
% what was the point of p?
% -M

return;

